<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class="app-container">
    <el-form id="mvcfm">
      <el-row>
        <el-col :span="25" :xs="24">
          <el-button @click="gotoPage('/psi/supplychainmana/InventoryAdd?'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加盘存</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 盘存记录 </span>
          </div>
          <el-table :data="p_quote">
            <el-table-column label="#" align="center" type='index'>
            </el-table-column>
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/psi/supplychainmana/InventoryDetailsSupply?CMID='+scope.row.quote_id+''+vueparams+'')">查看</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_quote('&CMID='+scope.row.quote_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="盘存" prop="quote_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/psi/supplychainmana/InventoryDet?CMID='+scope.row.quote_id+''+vueparams+'')" type='primary'>盘存-{{emt.map['quote_id']}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="盘存开始时间" prop="take_begin_date">
              <template slot-scope="scope">
                {{getDateTimeString(scope.row,'take_begin_date')}}
              </template>
            </el-table-column>
            <el-table-column label="盘存要求时间" prop="take_ask_date">
            </el-table-column>
            <el-table-column label="任务确定人" prop="contact_name">
            </el-table-column>
            <el-table-column label="任务确定时间" prop="take_date">
              <template slot-scope="scope">
                {{getDateTimeString(scope.row,'take_date')}}
              </template>
            </el-table-column>
            <el-table-column label="状态" prop="store_state">
              <template slot-scope="scope">
                {{getValueName("执行中=1,已完成=2",scope.row.store_state)}}
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'InventoryList',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        p_quote: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/main/InventoryAction/inventoryList?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_quote(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/main/InventoryAction/d_quote?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
